﻿using ServicioTecnico.Negocio;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ServicioTecnico.UI
{
    public partial class frmClienteABM : Form
    {
        public frmClienteABM()
        {
            InitializeComponent();
        }

        private void btnNuevo_Click(object sender, EventArgs e)
        {
            frmCliente frm = new frmCliente("ALTA");
            frm.MdiParent = this.MdiParent;
            frm.Show();
        }

        private void frmClienteABM_Load(object sender, EventArgs e)
        {
            GetClientes();
        }

        private void GetClientes()
        {
            var query = Clientes.FindAll();

            foreach(var row in query)
            {
                dgvClientes.Rows.Add(String.Format("{0:0000}", row.id), row.nombres, row.apellido, row.documento, row.razonsocial, row.direccion, row.telefono, row.celular, row.email, row.activo);
            }
        }

    
    }
}
